package com.cn.wanxi.service.impl;

import com.cn.wanxi.dao.ProductDao;
import com.cn.wanxi.dao.impl.ProductImpl;
import com.cn.wanxi.model.ProdudctModel;
import com.cn.wanxi.service.IProductService;

import java.util.List;

public class ProductServiceImpl implements IProductService {
    @Override
    public String add(ProdudctModel produdctModel) {
        ProductDao productDao = new ProductImpl();
        return productDao.add(produdctModel) == 1 ? "success" : "error";
    }

    @Override
    public List<ProdudctModel> findAll() {
        ProductDao productDao = new ProductImpl();
        return productDao.findAll();
    }

    @Override
    public ProdudctModel findById(int id) {
        ProductDao productDao = new ProductImpl();
        return productDao.findById(id);
    }
}
